package org.jeecg.modules.mobile.controller;

import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.base.controller.JeecgController;

import lombok.extern.slf4j.Slf4j;

import org.jeecg.modules.mobile.entity.MobileConfiguration;
import org.jeecg.modules.mobile.service.IMobileConfigurationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;

import java.util.List;

/**
 * @Description: 移动端服务器配置
 * @Author: jeecg-boot
 * @Date:   2023-08-22
 * @Version: V1.0
 */
@Api(tags="移动端服务器配置")
@RestController
@RequestMapping("/mobile/configuration")
@Slf4j
public class MobileConfigurationController extends JeecgController<MobileConfiguration, IMobileConfigurationService> {
	@Autowired
	private IMobileConfigurationService mobileConfigurationService;
	
	/**
	 *   保存
	 *
	 * @param mobileConfiguration
	 * @return
	 */
	@AutoLog(value = "移动端服务器配置-保存")
	@ApiOperation(value="移动端服务器配置-保存", notes="移动端服务器配置-保存")
	@PostMapping(value = "/save")
	public Result<String> add(@RequestBody MobileConfiguration mobileConfiguration) {
		mobileConfigurationService.saveConfiguration(mobileConfiguration);
		return Result.OK("保存成功！");
	}
	
	/**
	 * 查询服务器配置
	 *
	 * @return
	 */
	@ApiOperation(value="移动端服务器配置-查询服务器配置", notes="移动端服务器配置-查询服务器配置")
	@GetMapping(value = "/list")
	public Result<List<MobileConfiguration>> list() {
		List<MobileConfiguration> list = mobileConfigurationService.list();
		return Result.OK(list);
	}

	 /**
	  * 连接测试
	  */
	 @ApiOperation(value = "移动端服务器配置-连接测试", notes = "移动端服务器配置-连接测试")
	 @GetMapping("/testConnection")
	 public Result testConnection() {
		 return Result.OK("连接测试成功");
	 }
}
